package tech.yangzhijie.basic.design.patterns.creational.factory.simplefactory;

/**
 * 简单工厂或者静态工厂
 */
public class SimpleFactory {

    public static Product getProduct(String productName){
        if("Laptop".equals(productName)) return new Laptop();
        else if("GraphicsCard".equals(productName)) return new GraphicsCard();
        else throw new RuntimeException("不存在的产品" + productName);
    }
}
